package com.luo.gmall.search.controlller;

import com.luo.gmall.search.service.SearchService;
import com.luo.gmall.search.vo.SearchParamVo;
import com.luo.gmall.search.vo.SearchResponseVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @author Zoro
 * @date 2021年11月09
 */
@Controller
public class SearchController {

    @Autowired
    private SearchService searchService;


    @GetMapping("search")
    public String search(SearchParamVo searchParamVo, Model model) {

        SearchResponseVo responseVo = searchService.search(searchParamVo);
        model.addAttribute("searchParam", searchParamVo);
        model.addAttribute("response", responseVo);
        return "search";

    }
}
